<template>
	<view class="cancellation">
		<view class="">
			注销账号后,您将不能使用此账号登录APP
		</view>
		<view class="">
			您是否确认注销此账户?
		</view>

		<view class="fixView" style="height: 260rpx;"> </view>
		<view class="fixBtn" style="height: 260rpx;">
			<button @click="cancellation" style="color: #999;">注 销</button>
			<button style="margin-top: 40rpx;" @click="back" type="warn">再 想 想</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userInfo: {}
			}
		},
		onLoad() {
			this.userInfo = uni.getStorageSync('userInfo')
		},
		methods: {
			back() {
				uni.navigateBack()
			},
			cancellation(e) {
				let title = '您确认要注销账号吗?'
				let isForceLogOut = false
				if (typeof e == 'string') {
					title = e + '或点击确定强制注销'
					isForceLogOut = true
				}
				uni.showModal({
					title: '提示',
					content: title,
					success: (val) => {
						if (val.confirm) {
							uni.showLoading()
							this.$http('Base_Manage/Base_VIPUserInfo/UserAccountCancellation?isForceLogOut=' +
								isForceLogOut).then(
								res => {
									uni.hideLoading()
									if (res.Success) {
										uni.removeStorageSync('propData')
										uni.removeStorageSync('userInfo')
										uni.removeStorageSync('tokenKey')
										uni.removeStorageSync('password')
										uni.removeStorageSync('userName')
										uni.reLaunch({
											url: '/pages/index/index'
										})
									} else {
										// this.$api.msg(res.Msg)
										this.cancellation(res.Msg)
									}
								})
						}
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.cancellation {
		height: 100%;
		background-color: #fff;
		padding: 20rpx;
		padding-top: 100rpx;
		box-sizing: border-box;
		text-align: center;
		color: #666;
	}
</style>